let arr = [1,2,4,8,3,9,5]

let newArr = arr.sort((a,b) => {
    return a-b
})

console.log(newArr);